/*
 * @Description:
 * @Author: 胡涛
 * @Date: 2023-10-15 00:31:03
 * @LastEditors: 胡涛
 * @LastEditTime: 2023-10-15 00:32:21
 */
import api from "@/api";
import { ListResultDto, PagedListResultDto } from "../types";
import { GetAttachmentConfigInputDto, AttachmentConfigDto } from "./types";

export default {
  /**
   * 获取单条记录
   * @param id
   * @param data
   * @returns
   */
  get(id: string): Promise<AttachmentConfigDto> {
    return api.get("/api/Platform/Resources/attachmentConfig/" + id);
  },
  /**
   * 获取列表
   * @param id
   * @param data
   * @returns
   */
  getList(
    data: Partial<GetAttachmentConfigInputDto>
  ): Promise<PagedListResultDto<AttachmentConfigDto>> {
    return api.get("/api/Platform/Resources/attachmentConfig", data);
  },
  /**
   * 获取列表（不分页）
   * @param id
   * @param data
   * @returns
   */
  getAllList(
    data: Partial<GetAttachmentConfigInputDto>
  ): Promise<Array<AttachmentConfigDto>> {
    return api.get("/api/Platform/Resources/attachmentConfig/all", data);
  },
  /**
   * 添加
   * @param id
   * @param data
   * @returns
   */
  create(data: Partial<AttachmentConfigDto>): Promise<AttachmentConfigDto> {
    return api.post("/api/Platform/Resources/attachmentConfig", data);
  },
  /**
   * 修改
   * @param id
   * @param data
   * @returns
   */
  update(
    id: string,
    data: Partial<AttachmentConfigDto>
  ): Promise<AttachmentConfigDto> {
    return api.put("/api/Platform/Resources/attachmentConfig/" + id, data);
  },
  /**
   * 删除
   * @param id
   * @returns
   */
  delete(id: string): Promise<AttachmentConfigDto> {
    return api.delete("/api/Platform/Resources/attachmentConfig/" + id);
  },
};
